import { createApp, nextTick } from 'vue'
import App from './App.vue'
import defineComponents from '@/utils/defineComponents'
import router from './router'
// moment 或者 date-fns
// import DatePicker from 'ant-design-vue/es/date-picker/moment'
// import TimePicker from 'ant-design-vue/es/time-picker/moment'
// import Calendar from 'ant-design-vue/es/calendar/moment'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.less'
import './styles/index.css'
import './styles/global.less'
import './styles/theme-vars.less'
import cmsViews from '@cms/views'
import * as icons from '@ant-design/icons-vue'
import { store } from './stores'
//引入字体图标库
import '@/assets/icon-font/iconfont.css'
import appInfo from '../package.json'
import { copyRightConsole } from './utils/copyRightConsole'
import 'virtual:svg-icons-register'
copyRightConsole(appInfo)
const app = createApp(App)
//app.config.globalProperties.$baseUrl = import.meta.env.VITE_BASE_URL
app.config.globalProperties.$baseUrl = window.location.origin
app.use(defineComponents)
app.use(cmsViews)
app.use(router)
// app.use(DatePicker).use(TimePicker).use(Calendar)
app.use(Antd)
//Ant design vue 由于一些组件默认是英文，所以需要汉化
nextTick(() => {
  // app.provide('baseUrl', import.meta.env.VITE_BASE_URL)
  app.provide('baseUrl', window.location.origin)
})
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')
app.use(store)
for (const key in icons) {
  app.component(key, (icons as any)[key])
}

app.mount('#app')
